home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
blankery
/
bserverdir
/
sources
/
clients
/
shutscreen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-29
|
4KB
|
170 lines
; /*
sc shutscreen.c DATA=FAR NMINC STRMERGE NOSTKCHK IGNORE=73 STRUCTUREEQUIVALENCE NOSTDIO
slink from lib:c.o shutscreen.o to //Clients/ShutScreen lib /lib/client.lib lib:sc.lib lib:amiga.lib SC SD STRIPDEBUG NOICONS
delete shutscreen.o
quit
ShutScreen 1.2 (Client for BServer)
Copyright © 1994 Stefano Reksten of 3AM - The Three Amigos!!!
All rights reserved.
*/
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <graphics/scale.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include "/include/client.h"
#include "/include/bitmap/bitmap.h"
#include "/include/bitmap/bitmap_pragmas.h"
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *BitMapBase;
struct Screen *clonescr, *scr;
UWORD scrwidth, scrheight, scrdepth;
ULONG command;
struct BitMap *bmap, *scalebmap;
struct DisplayIDInformation *dinfo;
struct BitMapScaleInfo myscaleinfo = {
NULL, NULL, NULL, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, NULL };
void Shut( void )
{
BOOL still_blitting;
BOOL blanking, success = FALSE;
UWORD n, frame;
ULONG color, darkest_color = 0xF, darkest_index = 0;
clonescr = IntuitionBase->FirstScreen;
scrwidth = clonescr->Width;
scrheight = clonescr->Height;
scrdepth = clonescr->RastPort.BitMap->Depth;
if ( scalebmap = CreateBitMap( scrwidth, scrheight, scrdepth ) )
{
if ( bmap = CreateBitMap( scrwidth, scrheight, scrdepth ) )
{
BltBitMap( clonescr->RastPort.BitMap, 0, 0,
bmap, 0, 0, scrwidth, scrheight, 0xC0, 0xFF, NULL );
myscaleinfo.bsi_SrcBitMap = clonescr->RastPort.BitMap;
myscaleinfo.bsi_TempBitMap = scalebmap;
myscaleinfo.bsi_DestBitMap = bmap;
myscaleinfo.bsi_Width = scrwidth;
myscaleinfo.bsi_Height = scrheight;
myscaleinfo.bsi_VertDen = scrheight;
if ( scr = OpenScreenTags( NULL,
SA_Width, scrwidth,
SA_Height, scrheight,
SA_Depth, scrdepth,
SA_DisplayID, GetVPModeID( &clonescr->ViewPort ),
SA_BitMap, bmap,
SA_Overscan, OSCAN_TEXT,
TAG_END ) )
{
if ( scr->ViewPort.ColorMap = GetColorMap( 1<<scrdepth ) )
{
for ( n = 0; n < 1<<scrdepth; n++ )
{
color = GetRGB4( clonescr->ViewPort.ColorMap, n );
if ( (color & 0xF0)>>4 < darkest_color )
{
darkest_color = (color & 0xF0)>>4;
darkest_index = n;
}
SetRGB4( &scr->ViewPort, n, color >> 8, (color & 0xF0) >> 4, color & 0xF );
}
ScreenToFront( scr );
success = TRUE;
SpritesOff();
blanking = TRUE;
still_blitting = TRUE;
frame = 0;
SetAPen( &scr->RastPort, darkest_index );
while( blanking )
{
if ( still_blitting )
command = GetServerCommand();
else
command = WaitServerCommand();
if ( command != COMMAND_IDLE )
blanking = FALSE;
else
if ( still_blitting )
{
UWORD fr = frame>>1;
Move( &scr->RastPort, 0, fr );
Draw( &scr->RastPort, scrwidth - 1, fr );
Move( &scr->RastPort, 0, scrheight - fr - 1);
Draw( &scr->RastPort, scrwidth - 1, scrheight - fr - 1 );
frame += 2;
if ( frame > scrheight )
{
SetAPen( &scr->RastPort, 0 );
SetRGB4( &scr->ViewPort, 0, 0, 0, 0 );
SetRast( &scr->RastPort, 0 );
still_blitting = FALSE;
}
else
{
myscaleinfo.bsi_VertNum = scrheight - frame;
myscaleinfo.bsi_DestTopEdge = frame>>1;
ScaleBitMap( &myscaleinfo );
}
}
}
SpritesOn();
FreeColorMap( scr->ViewPort.ColorMap );
}
CloseScreen( scr );
}
DisposeBitMap( bmap );
}
DisposeBitMap( scalebmap );
}
if ( !success )
SendClientMsg( ACTION_FAILED );
}
void __main( char *line )
{
if ( IntuitionBase = (struct IntuitionBase *)OpenLibrary( "intuition.library", 36L ) )
{
if ( GfxBase = (struct GfxBase *)OpenLibrary( "graphics.library",0L ) )
{
if ( BitMapBase = OpenLibrary( "bitmap.library", 0L ) )
{
if ( dinfo = OpenCommunication() )
{
Shut();
CloseCommunication( dinfo );
}
CloseLibrary( BitMapBase );
}
CloseLibrary( (struct Library *)GfxBase );
}
CloseLibrary( (struct Library *)IntuitionBase );
}
}